
#ifndef IPROCESSOR_H
#define IPROCESSOR_H

#include "comm.h"
#include <angelscript.h>

#include <ITrigger.h>

#ifdef __cplusplus
extern "C" {
#endif

class IProcessor
{
public:
	//virtual ~IProcessor() {}
	virtual const std::string &getName() const = 0;
	virtual void config( asIScriptEngine *engine ){}

	~IProcessor() {
      for(TriggerVector::reverse_iterator It = m_Triggers.rbegin();
          It != m_Triggers.rend();
          ++It)
        delete *It;
    }

	void addTrigger(std::auto_ptr<ITrigger> T) {
      m_Triggers.push_back(T.release());
    }

	size_t getTriggerCount() const {
      return m_Triggers.size();
    }
	
	ITrigger &getTrigger(size_t Index) {
      return *m_Triggers.at(Index);
    }

private:
	typedef std::vector<ITrigger *> TriggerVector;
	TriggerVector m_Triggers;
};

#ifdef __cplusplus
}
#endif

#endif